<%@ page isELIgnored="false"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title> Home - ${user.firstName} ${user.lastName} </title>
</head>
<body>
	
	<div style="width:800px; margin:auto; margin-top: 40px; font-size: 1.1em;" >
		<c:choose>
			<c:when test="${courseCount > '0' }">
				<p>Here are the classes you can currently join, ${user.firstName}</p>
				<table style="width: 780px; text-align: center;">
					<c:forEach items="${courses}" var="course">
						<tr>
							<td style="border: solid 1px #bbbbbb;">
								<a href="/student/course/${course.id}/join" > Join </a>
							</td>
							<td style="border: solid 1px #bbbbbb;">
								${course.courseName}
							</td>
							<td style="border: solid 1px #bbbbbb;">
								${course.section}
							</td>
							<td style="border: solid 1px #bbbbbb;">
								${course.season}
							</td>
						</tr>
					</c:forEach>
				</table>
			</c:when>
			<c:otherwise>
				<p> There are currently no available classes for you to join.</p>
			</c:otherwise>
		</c:choose>
	</div>
	
</body>
</html>